package com.example.market.config;

import java.io.FileWriter;
import java.io.IOException;

public class AlipayConfig {



    // 应用ID,您的APPID，收款账号既是您的APPID对应支付宝账号,开发时使用沙箱提供的APPID，生产环境改成自己的APPID

    public static String APP_ID = "2021000118600514";



    // 商户私钥，您的PKCS8格式RSA2私钥

    public static String APP_PRIVATE_KEY = "MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCwgErm8mbKLjTfQikO2GHP3Dk+gB0qBLBtW05TAouf0AsftrluKk6tRNrBy6i6h+QYgb3UxLTIUTKRPVk9mI/EIVjBDCGSL/RSylNxqhqH4xR7qblDqOuJnU5lz1yCa41wuwC0c7bs+MWmKZ/Qx46OuwIg8RXNmjBwyIjyCO4+bztnSipvNqlopNU9AAUkRMS54c2VYGITdEeK+5dRF64n7djpVmzihjnzxf6siG2NmWI0wSTHe9XYD+WhokCtzDVzWL63xD94c0HfDKCS+5wPBfiTcPiM/yPOTkP487VALJv3MQHKdetQlzJat9Wds7+xbvp7Us4KxswhpCh/rO0FAgMBAAECggEBAJHuYP+2J/q+XYTCRQQ7MBQWd1YPww08t0qTlZzYm+zUrH3aLFLDtC1aoqxc4PLo7FS+4N+MjBSb3f1sBd8BxsxY7fMfPpqJ/658DqYKCMmVnRfp6n3gqm4rm+hdnJVQq68rTpfknLgtr+2EuNh8RogIYugtrONDuw1lIKVNcP44xcvwZuK5IVk1C3Pe2qtz2aQ4dU9k26T2oVNYsrgzml9HoX7lKfo0qiJcMMcDeVjF0Y1aDVmpHotLKXlPdv2HjicfbKdF5YYo0lM9stxznnQotpO/An1W9NeSzK5IihAsyNU5mS/GYWKsHgIFjNlfiQP10pdKtQqc1F3ihkrzLkECgYEA3ZX4Hicyb0GxqHBeTzjUeYV4WmD1c6y6MDnCviTlcEcWCwNlJaQucEuALkh+R+zPcKPaYWTWGM5fxvbIn6rXx5MNz8Np3+Ig9QJcq3gJPUdyhIlkkWaYojt/XBY2IUQ2AxVUBRWuTiYAGsc6WSqHHD2Yqv/tdrCqSYAOiwRsPO0CgYEAy+nNP62e7ynvFJsSELthAA6YyC4CsfUQeziR1o0Qsf35WpJMIpgV+9X072pXRHpJ0u++BB8RAHQ8TPIvZUB0kVW1CVxpWwq/59VwnH4QVoWzsvK2JuVFgnWL681JIx9uObP+/e2UT2f2oIdBgnbqEaOPTJNv8PxGTFzSAKGxhXkCgYBcMEK0ONaQ1yIU0/tItnofvNnfsCsuXxRvb/iHp04Vsl2HY3g3euEfMyo3F04CmpGLaYA3uP4h/+p1GsNJOojfrVy3rbNkw+22Qa9QX3ZomksYvRisLaUfCeXo6AzJNlnKWptEKksElGbCvVSXOExSAYZ8zlF7afDO94oVaFen2QKBgGM8VyzEO/K8f6ORjAskhaJXeDcDXUBpuSmecCrv384fgXh4diDnztsOVvMk12916/OBxQGQdN+5sZbozfQCmDgac84ocQVjh901XGZsW1sgGkHeKJNpRJimx/9rmkpDg4sFc/Tz6Bd0yut4p4LsiCEpbhWgMvweab/D9FdmWVRRAoGANwjPsS/kwAAe9meZsbjot2VXI0yBZFQGoabCd1ls3gNewk8d9/DB3k+lHAFEBu8FyGcOF9VboFgb0FxdTYKF5+nUvS4go48uSq2kfnHtywwDFxMAX4QgEC9/VvNZgmGu1pTUmelDwPI66YuBMrbRA8djyKFk2VwMgT4uMLTTnas=";



    // 支付宝公钥,查看地址：https://openhome.alipay.com/platform/keyManage.htm 对应APPID下的支付宝公钥。

    public static String ALIPAY_PUBLIC_KEY = "MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAr6DxEsIQ4dH+i2laXeDzdGyDYzPF4BZr+LYomX5JtzuZPxzvdndu682PxoQ+KLPGl279b3qsN0dV+aI8WRBgoIZimvYM8KJD6sxSu8ZxPTK+s26AKvANSutDHFKLsZIR1Hs68G+aqnZNYK/oPky9qW2T+GiE/KE+ooeo5+QrBXH5gmUZIFpurNABySh19ZwcKlERacbXcZeB4CUQh6riEeAiGVErcwsmaDXLVSg3xYqUgowMTegXsQXb3dYW3uZwu1urWyT1+aGYd+TW9lAtKIiRROJqCTn7QZmD6ZcXQuuUlLSEytXDRtHfSiAp2tjo49RIZwAi8oiOpx88PzpDowIDAQAB";



    // 服务器异步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问

    public static String notify_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/notify_url.jsp";



    // 页面跳转同步通知页面路径 需http://格式的完整路径，不能加?id=123这类自定义参数，必须外网可以正常访问(其实就是支付成功后返回的页面)

    public static String return_url = "http://localhost:8080/alipay.trade.page.pay-JAVA-UTF-8/return_url.jsp";



    // 签名方式

    public static String sign_type = "RSA2";



    // 字符编码格式

    public static String CHARSET = "utf-8";



    // 支付宝网关，这是沙箱的网关

    public static String gatewayUrl = "https://openapi.alipaydev.com/gateway.do";



    // 支付宝网关

    public static String log_path = "C:\\";





//↑↑↑↑↑↑↑↑↑↑请在这里配置您的基本信息↑↑↑↑↑↑↑↑↑↑↑↑↑↑↑



    /**
     * 写日志，方便测试（看网站需求，也可以改成把记录存入数据库）
     * @param sWord 要写入日志里的文本内容
     */

    public static void logResult(String sWord) {

        FileWriter writer = null;

        try {

            writer = new FileWriter(log_path + "alipay_log_" + System.currentTimeMillis()+".txt");

            writer.write(sWord);

        } catch (Exception e) {

            e.printStackTrace();

        } finally {

            if (writer != null) {

                try {

                    writer.close();

                } catch (IOException e) {

                    e.printStackTrace();

                }

            }

        }

    }
}